#pragma once
#include "HSModelAPI.h"
#include <string>
#include <list>
#include <functional>

class EventArguments
  {
  public:
    HSMODEL_API EventArguments(const std::string& i_string);
    HSMODEL_API const std::string& GetString() const;
  private:
    const std::string& m_string;
  };

typedef std::function<void(EventArguments)> Observer;

class Observable
  {
  public:
    virtual void AddSubscriber(Observer i_observer) = 0;
    virtual void RemoveSubscriber(Observer i_observer) = 0;
    virtual void Notify(EventArguments& e) = 0;
    virtual ~Observable() {}
  };

class SimpleEvent : public Observable
  {
  public:
    SimpleEvent();
    virtual void AddSubscriber(Observer i_observer);
    virtual void RemoveSubscriber(Observer i_observer);
    virtual void Notify(EventArguments& e);
  private:
    std::list<Observer> m_subscribers;
  };